import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {TestComponent} from './test/test.component';
import {FrontComponent} from './front/front.component';
import {Code404Component} from './code404/code404.component';
import {StructComponent} from './front/struct/struct.component';
import {StyleComponent} from './front/style/style.component';
import {ScriptComponent} from './front/script/script.component';
import {JavascriptComponent} from './front/script/javascript/javascript.component';
import {TypescriptComponent} from './front/script/typescript/typescript.component';
import {DesignModule} from './design/design.module';

const routes: Routes = [
  {path: '', redirectTo: '/design', pathMatch: 'full'},
  {path: 'index', redirectTo: '/design', pathMatch: 'full'},
  {path: 'design', loadChildren: './design/design.module#DesignModule'},
  {path: 'test', component: TestComponent},
  {path: 'front', component: FrontComponent, children: [
      {path: '', redirectTo: '/front/struct', pathMatch: 'full'},
      {path: 'struct', component: StructComponent},
      {path: 'style', component: StyleComponent},
      {path: 'script', component: ScriptComponent, children: [
          {path: '', redirectTo: '/front/script/javascript', pathMatch: 'full'},
          {path: 'javascript', component: JavascriptComponent},
          {path: 'typescript', component: TypescriptComponent},
          {path: 'compare', component: JavascriptComponent, outlet: 'js'},
          {path: 'compare', component: TypescriptComponent, outlet: 'ts'}
        ]}
    ]},
  {path: 'back', loadChildren: './back/back.module#BackModule'},
  {path: '**', component: Code404Component}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
